package com.victor.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.victor.entity.Bookcase;

@Mapper
public interface BookcaseDao {
	int batchDelete(@Param("ids") int[] ids);

	int insert(Bookcase record);

	Bookcase findById(Integer bId);

	int update(Bookcase record);

	List<Map<String, String>> findByAttribute(Bookcase bookcase);

	List<Map<String, String>> findByUseridm(@Param("userid") String userid, @Param("limit") Integer limit,
			@Param("bType") Integer bType, @Param("pictype")Integer pictype);

	List<Bookcase> findByParam(Bookcase bookcase);

	int batchInsert(List<Bookcase> list);

	// 查找限时免费 订购 过期数据
	List<Bookcase> findOverdue();

	// 通过userid 查询 绘本系列id
	@Select({
			"SELECT sp_sid FROM bookcase b LEFT JOIN seriesandpicbook sp ON b.b_picid = sp.sp_pid WHERE b.b_userid = #{userid}" })
	List<String> findSidByUserid(@Param("userid") int userid);

}